<script>
  export default {
    props: {
      emptyText: String,
      column: {
        type: Array,
        required: true
      },
      dataSource: {
        type: Array,
        required: true
      },
      rowKey: {
        type: String,
        default: 'id'
      }
    },
    data() {
      return {
      }
    },
    
    methods: {
      
    }
  }
</script>

<template>
  <uni-table border stripe :empty-text="emptyText">
    <uni-tr style="background-color: #e9f1fe">
      <uni-th v-for="(item,index) in column" :key="item.key" :width="item.width" align="center">{{ item.title }}</uni-th>
    </uni-tr>
    <uni-tr v-for="(item,index) in dataSource" :key="item[rowKey]">
      <uni-td align="center" v-for="child in column" :key="child.key + item[rowKey]">{{ item[child.key] }}</uni-td>
    </uni-tr>
  </uni-table>
</template>